package asteroids.expression;

import asteroids.model.programs.*;
import asteroids.expression.BooleanComparator.Compatibility;

public class Equal extends BooleanComparator {

	public Equal(Expression left, Expression right) {
		super(left, right);
	}

	@Override
	public boolean getValue(Program program) {
		this.updateArguments(program);

		if (this.comp == Compatibility.NONE) {
			return false;
		} else if (this.comp == Compatibility.NUMERIC) {
			return (((NumericExpression) outArg1).getValue(program) == ((NumericExpression)outArg2)
					.getValue(program));
		} else {
			return (((EntityExpression) outArg1).getValue(program) == ((EntityExpression) outArg2)
					.getValue(program));
		}
	}
}
